import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
from selenium.webdriver.support.select import Select
testCase="DBshop019_后台商品管理-添加属性流程"
groupname='好好学习'

firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu3(firefox,'商品管理','商品属性','属性')
firefox.find_element_by_xpath('//a[text()=" 添加属性"]').click()
Select(firefox.find_element_by_id('attribute_group_id')).select_by_visible_text(groupname)
Select(firefox.find_element_by_id('attribute_type')).select_by_visible_text('下拉')
firefox.find_element_by_id('attribute_name').send_keys('天天向上')
#
firefox.find_element_by_xpath('//button').click()
time.sleep(2)

a=firefox.find_element_by_xpath('//table/tbody/tr[1]/td[3]').text
if a==groupname:
    writeLog("%s 测试通过"%testCase)
    print("%s 测试通过"%testCase)
else:
    writeLog("%s 测试失败" % testCase)
    print("%s 测试失败" % testCase)

firefox.quit()
